'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	if (event.queryStringParameters && event.queryStringParameters.fileID) {
		let {fileList} = await uniCloud.getTempFileURL({
		    fileList: [event.queryStringParameters.fileID]
		});
		return {
			mpserverlessComposedResponse: true, // 使用阿里云返回集成响应是需要此字段为true
			isBase64Encoded: false,
			statusCode: 301,
			headers: {
				'location': fileList[0].download_url
			}
		}
	}
	return {
		mpserverlessComposedResponse: true, // 使用阿里云返回集成响应是需要此字段为true
		isBase64Encoded: false,
		statusCode: 400
	}
};
